import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import nProgress from 'nprogress'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'root',
    component: () => import('@/views/turbine6.vue'),
    meta: {
      compName: 'CYRD',
    },
  },
  {
    path: '/power',
    name: '2',
    component: () => import('@/views/powerIsland.vue'),
    meta: {
      compName: 'HLHS',
    },
  },
  {
    path: '/backpressure',
    name: '3',
    component: () => import('@/views/backPressure.vue'),
    meta: {
      compName: 'HNHY',
    },
  },
  /* {
    path: '/test',
    name: 'test',
    component: () => import('@/views/test.vue'),
  }, */
]

const router = createRouter({
  history: createWebHistory(),
  routes,
})

nProgress.configure({ showSpinner: false })
router.beforeEach((to, from, next) => {
  nProgress.start()
  next()
})

router.afterEach(() => {
  nProgress.done()
})

export default router
